import Vue from 'vue'
import Router from 'vue-router'

import HelloWorld from '@/components/HelloWorld'
import LoginHome from "../views/login/LoginHome";

Vue.use(Router)
const RouterPush = Router.prototype.push
Router.prototype.push = function push(to) {
  return RouterPush.call(this, to).catch(err => err)
}
const RouterReplace = Router.prototype.replace
Router.prototype.replace = function replace(to) {
  return RouterReplace.call(this, to).catch(err => err)
}
export default new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      name: 'login-home',
      component: LoginHome
    },

    //首页
    {
      path: '/blogHome',
      name: 'blogHome',
      component: () => import('@/views/home/index'),
      children: [
        {path: '/', name: '首页', component: () => import('@/views/home/BlogHome')},
        {path: '/classify', name: '分类', component: () => import('@/views/home/BlogClassify')},
        {path: '/tags', name: '标签', component: () => import('@/views/home/BlogTags')},
        {path: '/message', name: '留言', component: () => import('@/views/home/BlogMessage')},
        {path: '/archive', name: '归档', component: () => import('@/views/home/BlogClassify')},
        {path: '/about', name: '关于', component: () => import('@/views/home/BlogAbout')},
        {path: '/thread-message', name: '云畅言', component: () => import('@/views/home/BlogThreadMessage')},
        {path: '/blogSearch', name: '/blogSearch', component: () => import('@/views/home/SearchDataItem')},

      ]
    },

    //首页
    {
      path: '/blogHome',
      name: 'blogHome',
      component: () => import('@/views/home/index'),
      children: [
        {path: '/blogInfoById/:id', name: '文章详情', component: () => import('@/views/content/BlogInfo')},
      ]
    },


    //跳转到指定规则的文章列表
    {
      path: '/blogHome',
      name: 'blogHome',
      component: () => import('@/views/home/index'),
      children: [
        {path: '/tagsArticle/:tagsName', name: '相关内容', component: () => import('@/views/relevant/BlogListByTags')},
        {path: '/blogTags/:classifyName', name: '相关分类', component: () => import('@/views/relevant/BlogTags')},

      ]
    },


    //博客后台管理
    {
      path: '/blogManage',
      name: '后台',
      component: () => import('@/views/layout/Layout'),
      children: [
        {path: '/', name: '用户信息', component: () => import('@/views/back_manage/UserInfo')},
        {path: '/manageBlog', name: '发布文章', component: () => import('@/views/back_manage/ReleaseBlogs')},
        {path: '/updateBlog', name: '修改文章', component: () => import('@/views/back_manage/ManageBlogs')},
        {path: '/userBlogTags', name: '标签', component: () => import('@/views/back_manage/UserBlogTags')},
        {path: '/userClassify', name: '分类', component: () => import('@/views/back_manage/BlogsByClassify')},
        {path: '/manageBlogList', name: '文章管理', component: () => import('@/views/back_manage/BlogsManage')},
        {path: '/blogInfo', name: '文章信息', component: () => import('@/views/back_manage/BlogInfo')},
        {path: '/blogDrafts/:articleUsername', name: '草稿箱', component: () => import('@/views/back_manage/BlogDrafts')},
        {path: '/blogRecycle', name: '回收站', component: () => import('@/views/back_manage/BlogRecycle')},
      ]
    }

  ]
})
